package org.seckill.enums;

import org.eclipse.jdt.internal.compiler.ast.ReturnStatement;

/**
 * 
 * @author chenyue
 *
 */
public enum seckillStateEnum {
	SUCCESS(1,"秒杀成功"),
	END(0,"秒杀结束"),
	REPEA_KILL(-2,"重复秒杀"),
	INNER_ERROR(-3,"内部错误"),
	DATA_REWRITE(-4,"数据异常")
	;
	private Integer state;
	private String stateInfo;
	
	seckillStateEnum(Integer state, String stateInfo) {
		this.state = state;
		this.stateInfo = stateInfo;
	}

	public int getState() {
		return state;
	}

	public String getStateInfo() {
		return stateInfo;
	}
	
	public  static seckillStateEnum stateOf(int index){
		for (seckillStateEnum state : values()) {
			if (state.getState() == index) {
				return state;
			}
		}
		return null; 
	}
}
